package com.ywl.webserver;

import java.net.ServerSocket;
import java.net.Socket;

import com.ywl.webserver.core.ServerCore;
import com.ywl.webserver.util.ConfigUtil;

/**
 * web服务器启动入口类
 * @author wl.yang
 *
 */
public class ServerMain 
{
    public static void main( String[] args )
    {
    	//读取配置文件
    	ConfigUtil.init();
    	
    	try {
			//启动socket服务接收访问
			ServerSocket serverSocket = new ServerSocket(ConfigUtil.port);
			System.out.println("web服务器已经成功启动...");
			while (true) {
				Socket socket = serverSocket.accept();
				new ServerCore(socket).start();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
    }
    
}
